<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>轻聊天平台</title>
    <link rel="stylesheet" href="/system/layui/src/css/layui.css" media="all" />
    <link rel="stylesheet" href="/system/css/index.css" media="all" />
</head>
<body class="main_body">
<div class="layui-layout layui-layout-admin">
    <!-- 顶部 -->
    <div class="layui-header header">
        <div class="layui-main mag0">
            <!-- 显示/隐藏菜单 -->
            <h2 style="color: #FFFFFF">轻聊天平台--------翊辰</h2>
            <!-- 顶部右侧菜单 -->
            <ul class="layui-nav top_menu">
                <li class="layui-nav-item addGroup" pc>
                    <a id="addGroup" href="javascript:;"><i class="layui-icon">&#xe61f;</i><cite>创建群聊</cite></a>
                </li>
                <li class="layui-nav-item addMessage" pc>
                    <a id="addMessage" href="javascript:;"><i class="layui-icon">&#xe63c;</i><cite>申请信息</cite></a>
                </li>
                <li class="layui-nav-item addFriend" pc>
                    <a id="addFriend" href="javascript:;"><i class="layui-icon">&#xe770;</i><cite>添加好友</cite></a>
                </li>
                <li class="layui-nav-item message" pc>
                    <a ondragstart="return false" id="message" href="/message/toMessage" target="right_view"><i class="layui-icon">&#xe770;</i><cite>开发信息</cite></a>
                </li>
                <li class="layui-nav-item exit" pc>
                    <a href="/login/outLogin"><i class="layui-icon">&#xe682;</i><cite>退出登录</cite></a>
                </li>
            </ul>
        </div>
    </div>
    <!-- 左侧导航 -->
    <div class="layui-side layui-bg-black">
        <div class="user-photo">
            <a ondragstart="return false" href="/message/toMessage" target="right_view" class="img" title="我的头像" ><img src="/system/images/face.jpg" class="userAvatar"></a>
            <p>你好！<span th:text="${session.name}"></span>, 欢迎登录</p>
        </div>
        <ul class="layui-nav layui-nav-tree layui-bg-cyan layui-inline" lay-filter="demo">
            <li class="layui-nav-item layui-nav-itemed">
                <a href="javascript:;" data-url="page/main copy.html"><i class="layui-icon">&#xe613;</i>我的群聊</a>
                <dl class="layui-nav-child" id="groups">
                </dl>
            </li>
        </ul>
        <ul class="layui-nav layui-nav-tree layui-bg-cyan layui-inline" lay-filter="demo">
            <li class="layui-nav-item layui-nav-itemed">
                <a href="javascript:;" data-url="page/main copy.html"><i class="layui-icon">&#xe612;</i>我的好友</a>
                <dl class="layui-nav-child" id="friends">
                </dl>
            </li>
        </ul>
    </div>
    <!-- 右侧内容 -->
    <div class="layui-body layui-form" >
        <iframe id="page" name="right_view" src=""></iframe>
    </div>
</div>
<!-- 移动导航 -->
<div class="site-tree-mobile"><i class="layui-icon">&#xe602;</i></div>
<div class="site-mobile-shade"></div>
<script type="text/javascript" src="/system/js/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="/system/layui/src/layui.js"></script>
<script type="text/javascript" src="/system/js/index.js"></script>
</body>
</html>
<script type="text/javascript">
    var beginTime = 0;//执行onbeforeunload的开始时间
    var differTime = 0;//时间差
    window.onunload = function () {
        differTime = new Date().getTime() - beginTime;
    }
    window.onbeforeunload = function () {
        beginTime = new Date().getTime();
        if (differTime <= 1) {
            $.ajax({
                type: "POST", //请求方式是POST
                url: "/login/outLogins", //跳转到相应后台，清理session，退出操作
                dataType: "JSON", //数据类型是JSON
                cache: false //不需要缓存
            })
        }
    };
</script>